import static org.junit.Assert.*;

import java.util.LinkedList;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;


public class HandTest {

	private Hand hand;
	private List<Card> cards;
	
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		cards = new LinkedList<Card>();
		cards.add(new Card(0, 0));
		cards.add(new Card(3, 10));
		cards.add(new Card(2, 10));
		cards.add(new Card(1, 5));
		cards.add(new Card(0, 9));
		
		hand = new Hand();
		for(Card c: cards)
		{
			hand.giveCard(c);
		}
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testShowCards() {
		List<Card> shownCards = hand.showCards();
		
		assertEquals(cards.size(), shownCards.size());
		
		for(Card c: cards)
		{
			assertTrue(shownCards.contains(c));
		}
	}
	
	@Test
	public void testTakeCard()
	{
		Card c1 = cards.get(0);
		Card c2 = cards.get(1);
		hand.takeCard(c1);
		hand.takeCard(c2);
		
		assertEquals(cards.get(0), c1);
		assertEquals(cards.get(1), c2);
		
		List<Card> shownCards = hand.showCards();
		
		assertEquals(cards.size() - 2, shownCards.size());
		
		assertFalse(shownCards.contains(c1));
		assertFalse(shownCards.contains(c2));
		
		assertTrue(shownCards.contains(cards.get(3)));
	}
	
	

}
